const musicApi = {

    /**
     * 音乐生成
     *
     * @param params
     * @author zero
     */
    generate(params: any): Promise<any> {
        return $request.post({
            url: '/apply/music/generate',
            params
        })
    },

    /**
     * 音乐配置
     *
     * @param {string} engine 音乐引擎: [suno]
     * @returns {Promise<MusicConfigResponse>}
     * @author zero
     */
    config(engine: string): Promise<MusicConfigResponse> {
        return $request.get<MusicConfigResponse>({
            url: '/apply/music/config',
            params: {
                engine
            }
        })
    },

    /**
     * 音乐风格
     *
     * @returns {Promise<MusicStylesResponse[]>}
     * @author zero
     */
    styles(): Promise<MusicStylesResponse[]> {
        return $request.get<MusicStylesResponse[]>({
            url: '/apply/music/styles'
        })
    },

    /**
     * 音乐记录
     *
     * @param params
     * @param {number} [params.page_no] - 当前页码
     * @param {number} [params.page_size] - 每页条数
     * @param {number} [params.status] - 音乐状态
     * @param {string} params.engine - 音乐引擎
     * @returns {Promise<MusicRecordResponse[]>}
     * @author zero
     */
    record(params: {
        page_no?: number;
        page_size?: number;
        status?: number;
        engine: string;
    }): Promise<MusicRecordResponse[]> {
        return $request.get<MusicRecordResponse[]>({
            url: '/apply/music/record',
            params
        })
    },

    /**
     * 音乐生成检测
     *
     * @param {string[]} ids
     * @returns {Promise<MusicRecordResponse[]>}
     * @author zero
     */
    detection(ids: string[]): Promise<MusicRecordResponse[]> {
        return $request.post<MusicRecordResponse[]>({
            url: '/apply/music/detection',
            params: {
                ids
            }
        })
    },

    /**
     * 音乐记录删除
     *
     * @param {string} code
     * @returns {Promise<any>}
     * @author zero
     */
    delete(code: string):Promise<any> {
        return $request.post({
            url: '/apply/music/delete',
            params: {
                code
            }
        })
    },

    /**
     * 音乐广场分享
     *
     * @param {string} code
     * @returns {Promise<any>}
     * @author zero
     */
    square(code: string):Promise<any> {
        return $request.post({
            url: '/apply/music/square',
            params: {
                code
            }
        })
    },

    /**
     * 音乐记录收藏
     *
     * @param {string} code
     * @returns {Promise<any>}
     * @author zero
     */
    collect(code: string):Promise<any> {
        return $request.post({
            url: '/apply/music/collect',
            params: {
                code
            }
        })
    }
}

export default musicApi
